<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$merchid=$this->checklogin();
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示收入统计数据
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));

	//$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
	//$yeartime=strtotime(date('Y-m-d',mktime(0, 0 , 0,1,1,date("Y"))));
	
	//当日订单总金额
	$data['dayfee']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'finishtime >'=>$daytime),'price');
	//当日订单数
	$data['dayorder']=pdo_count('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'finishtime >'=>$daytime));
	
	//当日赠品统计
	$data['songfee']=pdo_getsum('jy_merch_mgoodslog',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'gtype'=>2,'createtime >'=>$daytime),'gprice');
	//当日现金线下收款收入
	$data['offpay']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'paytype'=>'offpay','ispay'=>1,'finishtime >'=>$daytime),'price')
	;
	//当日线下现金收入
	$data['cashoffpay']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'paytype'=>'offpay1','ispay'=>1,'finishtime >'=>$daytime),'price');	
	//当日线下微信收入
	$data['wxoffpay']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'paytype'=>'offpay3','ispay'=>1,'finishtime >'=>$daytime),'price');	
	//当日线下支付宝收入
	$data['zfboffpay']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'paytype'=>'offpay2','ispay'=>1,'finishtime >'=>$daytime),'price');
	//当日微信支付收入
	$data['wechat']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'paytype'=>'wechat','finishtime >'=>$daytime),'price');	
	//当日余额支付收入
	$data['credit']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'paytype'=>'credit','finishtime >'=>$daytime),'price');
	
	//当日抹零统计
	$data['molin']=pdo_getsum('jy_merch_mgoodslog',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'gtype'=>4,'createtime >'=>$daytime),'gprice');
	
	//当日退品统计
	$data['tuping']=pdo_getsum('jy_merch_mgoodslog',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'gtype'=>1,'createtime >'=>$daytime),'gprice');
	
	//当日劵抵扣统计
	$data['couponnums']=pdo_getsum('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'createtime >'=>$daytime),'coupon_de_price');
	
	//当日团购套餐统计
	$data['tcnums']=pdo_getsum('jy_merch_mgoodslog',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'gtype'=>2,'createtime >'=>$daytime,'istc'=>1),'gprice');
	
	
	$data['yearmembers']=pdo_getnorepeat('jy_weishop_order',array('merchid'=>$merchid,'uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'finishtime >'=>$yeartime),'mid');
	$data['yearmembers']=count($data['yearmembers']);
	
	$return['data']=$data;
	$return['shopset']=$this->plugin_setting('shopset');
	$return['logo']=$return['shopset']['logo']?:'../addons/jy_weishop/resource/images/logo.png';
	exi($return);
}